import java.util.*;

public class MC0418开启密码 {
    public static void main(String[] args) {

        Scanner input = new Scanner(System.in);
        // code here
        int n = input.nextInt();
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int num = input.nextInt();
            map.put(num, map.getOrDefault(num, 0) + 1);
        }

        if (n == 0) {
            input.close();
            return;
        }

        int maxCount = Collections.max(map.values());

        ArrayList<Integer> list = new ArrayList<>();
        for (Map.Entry<Integer, Integer> entry : map.entrySet()) {
            if (entry.getValue() == maxCount) {
                list.add(entry.getKey());
            }
        }
        //题目要求排序
        Collections.sort(list);

        for (Integer i : list) {
            System.out.println(i);
        }
        input.close();
    }
}
